# Contributor: Robert Sacks <robert@sacks.email>
# Maintainer: Robert Sacks <robert@sacks.email>
pkgname=wl-clipboard
pkgver=2.2.0
pkgrel=1
pkgdesc="Command-line copy/paste utilities for Wayland"
url="https://github.com/bugaevc/wl-clipboard"
arch="all"
license="GPL-3.0-or-later"
options="!check" # No test suite
makedepends="
	meson
	ninja
	wayland-dev
	wayland-protocols
	"
subpackages="
	$pkgname-doc
	$pkgname-bash-completion
	$pkgname-zsh-completion
	$pkgname-fish-completion
	"
source="https://github.com/bugaevc/wl-clipboard/archive/v$pkgver/wl-clipboard-$pkgver.tar.gz
	0001-Do-not-abort-when-interfaces-are-older-than-expected.patch
	0002-Tweak-binding-interfaces-further.patch
	"

build() {
	abuild-meson -Db_lto=true . build
	meson compile -C build
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C build

	# Install fish completion files into the correct directory
	rm -r "$pkgdir"/usr/share/fish/vendor_completions.d
	install -Dm644 completions/fish/wl-copy.fish \
		"$pkgdir"/usr/share/fish/vendor_completions.d/wl-copy.fish
	install -Dm644 completions/fish/wl-paste.fish \
		"$pkgdir"/usr/share/fish/vendor_completions.d/wl-paste.fish
}

sha512sums="
a2667b26970ebdd4c6d8bb6a05d902fa446fb94ba2c878dfa896e502277dac9837c75370108de9a39308597c153f3952289933174adf535148d027593a6cf829  wl-clipboard-2.2.0.tar.gz
7d2c464ed0dc583cd26de083b40c7bcbb7013e17778c09a49647c64b494f2b8418d2167b643810eff3e56d3c244b4a5ed2b06f766ba0a16a0b52718189d61ba8  0001-Do-not-abort-when-interfaces-are-older-than-expected.patch
2d6eefc25afc1b8ef39fdeefd5bc442f4379740dac881632da43a0fd936da91f14d72bf5584376d54e07944f8781666fab13d17b9b243c5f5880329a73bd946e  0002-Tweak-binding-interfaces-further.patch
"
